'use strict';

import React from 'react';
import {
    StyleSheet,
    Text,
    View,
} from 'react-native';
import styles from './styles';
import {connect} from 'react-redux'
import NaviUtil from '../../utils/NaviUtil';

import {naviPush} from '../../navigatorApp/actions'

class ShopState extends React.Component {

    constructor(props) {
        super(props);
    }

    onPress = () => {
        this.props.naviPush("shopComplete");
    };

    render() {
        let shopState ;
        if (this.props.shopState == 0) {
            shopState = <View style={styles.shopState} >
                <Text style={styles.shopStateText}>您还未创建店铺，请先创建店铺</Text>
                <Text style={styles.shopStateButton} onPress={this.onPress} >立即创建</Text>
            </View>
        } else if (this.props.shopState == 1) {
            shopState = <View style={styles.shopState} >
                <Text style={styles.shopStateText}>您的店铺还未通过审核，请完善店铺信息</Text>
                <Text style={styles.shopStateButton} onPress={this.onPress} >立即完善</Text>
            </View>
        } else if (this.props.shopState == 3) {
            shopState = <View style={styles.shopState} >
                <Text style={styles.shopStateText}>您的店铺正在审核中...</Text>
            </View>
        } else if (this.props.shopState == 2) {

        }

        return <View>
            {shopState}
        </View>
    }
}

const mapStateToProps = state => ({
    shopState:state.mainmodel.shopState,
});

const mapDispatchToProps = dispatch => ({
    naviPush:(routeName,params) => {
        dispatch(naviPush(routeName,params));
    }
});

export default connect(mapStateToProps, mapDispatchToProps)(ShopState);